<?php
namespace app\index\model;
class Payhistory extends BaseModel{
    
    function addHistory($data){
        $pay = D('payhistory');
        $pay->insert($data);
        
    }
    function getHistory($order_id){
        $pay = D('payhistory');
        return $pay->where("enable",0)->where("order_id",$order_id)->find();
    }
    function getHistoryAll($id,$page=1){
        $pay = D('payhistory');
        return $pay->where("enable",0)->where("status",1)->where("user_id",$id)->page($page,10)->order("create_time desc")->select();
    }
    function finishHistory($id){
        $pay = D('payhistory');
        $data['id'] = $id;
        $data['status'] = 1;
        $pay->update($data);
    }
}
